// ignore_for_file: prefer_const_constructors

import 'package:flutter/material.dart';

class LoginPages extends StatelessWidget {
  const LoginPages({super.key});

  @override
  Widget build(BuildContext context) {
    final arguments =
        ModalRoute.of(context)?.settings.arguments as Map<String, dynamic>;
    var phone = arguments['phone'];
    var password = arguments['password'];

    return Scaffold(
      appBar: AppBar(
          backgroundColor: Theme.of(context).colorScheme.inversePrimary,
          title: Text('Login')),
      body: Container(
        // width: double.infinity,
        // constraints: BoxConstraints(minWidth: double.infinity),
        padding: const EdgeInsets.all(2),
        margin: const EdgeInsets.all(4),
        decoration: BoxDecoration(
            border: Border.all(
              color: Colors.black,
            ),
            borderRadius: BorderRadius.all(Radius.circular(3))),
        child: DecoratedBox(
          decoration: BoxDecoration(color: Colors.black12),
          child: Column(
            // mainAxisAlignment: MainAxisAlignment.center,
            mainAxisSize: MainAxisSize.min,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                'phone: $phone',
                style: TextStyle(color: Colors.black),
              ),
              Text(
                'password: $password',
                style: TextStyle(color: Colors.red),
              ),
              Text(
                'text 13',
                style: TextStyle(color: Colors.blue),
              ),
              Row(
                mainAxisSize: MainAxisSize.min,
                children: [
                  Expanded(
                    flex: 1,
                    child: DecoratedBox(
                      decoration:
                          BoxDecoration(border: Border.all(color: Colors.red)),
                      child: Text(
                        'text 4',
                        textAlign: TextAlign.center,
                      ),
                    ),
                  ),
                  Expanded(
                    flex: 3,
                    child: Padding(
                      padding: EdgeInsets.fromLTRB(3, 0, 0, 0),
                      child: DecoratedBox(
                        decoration: BoxDecoration(
                            border: Border.all(color: Colors.lightGreen)),
                        child: Text(
                          'text 5',
                          textAlign: TextAlign.center,
                        ),
                      ),
                    ),
                  )
                ],
              ),
              // 可见性
              Offstage(
                offstage: true,
                child: Padding(
                  padding: EdgeInsets.fromLTRB(2, 8, 0, 8),
                  child: Text(
                    'offstage',
                    style: TextStyle(backgroundColor: Colors.white),
                  ),
                ),
              ),
              Container(
                constraints:
                    BoxConstraints(minWidth: double.infinity, minHeight: 48),
                decoration: BoxDecoration(
                    border: Border.all(color: Colors.blueGrey),
                    color: Colors.blueGrey),
                margin: EdgeInsets.fromLTRB(0, 4, 0, 0),
                padding: EdgeInsets.all(4),
                child: Stack(
                  alignment: Alignment.topLeft,
                  // fit: StackFit.expand,
                  children: const [
                    Text(
                      'top|start',
                      style: TextStyle(color: Colors.white),
                    ),
                    Positioned(
                      left: 1,
                      bottom: 1,
                      child: Text(
                        'bottom|start',
                        style: TextStyle(color: Colors.white),
                      ),
                    ),
                    Positioned(
                      right: 0,
                      child: Text(
                        'top|end',
                        style: TextStyle(color: Colors.white),
                      ),
                    ),
                    Positioned(
                      right: 1,
                      bottom: 1,
                      child: Text(
                        'bottom|end',
                        style: TextStyle(color: Colors.white),
                      ),
                    )
                  ],
                ),
              )
            ],
          ),
        ),
      ),
    );
  }
}
